#include "PageSetting.h"

PageSetting::PageSetting(ViewGroup *mWindPageBox)
    : PageBase(mWindPageBox, "@layout/page_setting", PAGE_SETTING)
{
    mBackHome = (ImageView *)this->dPageLayout->findViewById(demo::R::id::back);
    mTitle = (TextView *)this->dPageLayout->findViewById(demo::R::id::title);

    mSettingBox = (ViewGroup *)this->dPageLayout->findViewById(demo::R::id::layout1);
    mToConn = (ImageView *)this->dPageLayout->findViewById(demo::R::id::to_conn);

    mKaiduApp = (ViewGroup *)this->dPageLayout->findViewById(demo::R::id::layout2);

    mNewConn = (ViewGroup *)this->dPageLayout->findViewById(demo::R::id::layout3);

    mFinishLayout = (ViewGroup *)this->dPageLayout->findViewById(demo::R::id::layout4);
    mConnStatus = (ImageView *)this->dPageLayout->findViewById(demo::R::id::conn_status);
    mConnStatusText = (TextView *)this->dPageLayout->findViewById(demo::R::id::layout4_text);
    mResetNet = (ViewGroup *)this->dPageLayout->findViewById(demo::R::id::reset);

    mTitle->setText("设置");
    mSettingBox->setVisibility(View::VISIBLE);
    mKaiduApp->setVisibility(View::GONE);
    mNewConn->setVisibility(View::GONE);
    mFinishLayout->setVisibility(View::GONE);

    mBackHome->setOnClickListener(std::bind(&PageSetting::setOnClick, this, std::placeholders::_1));
    mToConn->setOnClickListener(std::bind(&PageSetting::setOnClick, this, std::placeholders::_1));
}

PageSetting::~PageSetting()
{
}

void PageSetting::setOnClick(View &v)
{

    switch (v.getId())
    {
    case demo::R::id::back:
    {
        d_windMgr->showPage(PAGE_MODE1);
    }
    break;
    case demo::R::id::to_conn:
    {
        mTitle->setText("网络设置");
        mSettingBox->setVisibility(View::GONE);
        mKaiduApp->setVisibility(View::VISIBLE);
    }
    break;
    default:
        break;
    }
}